/**********************************************************************
 Copyright (C) 2009 Jaakko Vuori

 This file is part of Cimer.
 For more information, see <http://code.google.com/p/cimer/>

 Cimer is free software: you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
 the Free Software Foundation, either version 3 of the License, or
 (at your option) any later version.

 Cimer is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 GNU General Public License for more details.

 You should have received a copy of the GNU General Public License
 along with Cimer.  If not, see <http://www.gnu.org/licenses/>.
 **********************************************************************/

#ifndef KEYEVENTHANDLER_H
#define KEYEVENTHANDLER_H

#include <QObject>
#include <QTimer>
class PieWidget;
class QKeyEvent;

class KeyEventHandler : public QObject
{
    Q_OBJECT
public:
    KeyEventHandler(PieWidget* pieWidget, QObject* parent = 0);
    void handleKeyPressEvent(QKeyEvent* event);
    void handleKeyReleaseEvent(QKeyEvent* event);

    void stop();

private slots:
    void timerEvent();

private:
    enum AdjustDirection
    {
        None,
        Increasing,
        Decreasing
    };
    AdjustDirection m_adjustDirection;

    QTimer m_keyTimer;
    PieWidget* m_pieWidget;
};

#endif // KEYEVENTHANDLER_H
